﻿<KCtl:BaseUserControl x:Class="Kiva7.Pages.LoanDetailControl"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:KCtl="clr-namespace:Kiva7.Controls"
    mc:Ignorable="d"
    FontFamily="{StaticResource PhoneFontFamilyNormal}"
    FontSize="{StaticResource PhoneFontSizeNormal}"
    Foreground="{StaticResource PhoneForegroundBrush}"
    d:DesignHeight="480" d:DesignWidth="480">


    <Grid>

        <ProgressBar Visibility="{Binding IsLoaded, Converter={StaticResource booleanToNotVisibility}}" 
                     IsIndeterminate="{Binding IsLoaded, Converter={StaticResource notBooleanConverter}}" 
                     Style="{StaticResource CustomIndeterminateProgressBar}"
                     VerticalAlignment="Center" />

        <ScrollViewer Visibility="{Binding IsLoaded, Converter={StaticResource booleanToVisibility}}">

            <StackPanel x:Name="LayoutRoot" Background="{StaticResource KivaBackgroundBrush}"
                        DataContext="{Binding SingleData}">

                <TextBlock x:Name="LoanID" Text="{Binding ID}" Visibility="Collapsed"/>

                <!-- <TextBlock Text="Name" Style="{StaticResource PhoneTextLargeStyle}"/>-->

                <StackPanel Style="{StaticResource KivaPanelTextLargeStyle}" Margin="12,0,0,0">
                    <TextBlock Text="{Binding Name}" Style="{StaticResource KivaTextLargeStyle}"
                           TextWrapping="Wrap"/>
                </StackPanel>


                <StackPanel  Style="{StaticResource KivaDetailStyle}">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="{Binding Sector}" Style="{StaticResource KivaTextAccentStyle}" TextWrapping="Wrap"/>
                        <TextBlock Text="{Binding Activity}" Style="{StaticResource KivaTextAccentStyle}" TextWrapping="Wrap"/>
                    </StackPanel>

                    <TextBlock Text="{Binding Path=L.Use, Source={StaticResource L}}" Style="{StaticResource KivaTextNormalStyle}"/>
                    <TextBlock x:Name="loanTranslation" Text="{Binding UseTranslation.Text}" Style="{StaticResource KivaTextAccentStyle}"
                       TextWrapping="Wrap"/>



                    <StackPanel>
                        <TextBlock Text="{Binding Path=L.Location, Source={StaticResource L}}" Style="{StaticResource KivaTextNormalStyle}"/>
                        <StackPanel Orientation="Horizontal">
                            <TextBlock Text="{Binding Location.Country}" Style="{StaticResource KivaTextAccentStyle}" TextWrapping="Wrap"/>
                            <TextBlock Text="{Binding Location.Town}" Style="{StaticResource KivaTextAccentStyle}" TextWrapping="Wrap"/>
                        </StackPanel>
                    </StackPanel>
                    <StackPanel>
                        <TextBlock Text="{Binding Path=L.Status, Source={StaticResource L}}" Style="{StaticResource KivaTextNormalStyle}"/>
                        <TextBlock Text="{Binding Status, Converter={StaticResource loanStatus}}" Style="{StaticResource KivaTextAccentStyle}"/>
                    </StackPanel>

                    <StackPanel>
                        <TextBlock Text="{Binding Path=L.NonPaymentRisk, Source={StaticResource L}}" Style="{StaticResource KivaTextNormalStyle}"/>
                        <TextBlock Text="{Binding Terms.LossLiability.Nonpayment}" 
                               Style="{StaticResource KivaTextAccentStyle}"/>
                    </StackPanel>

                    <StackPanel>
                        <TextBlock Text="{Binding Path=L.CurrencyExchangeRisk, Source={StaticResource L}}" Style="{StaticResource KivaTextNormalStyle}"/>
                        <TextBlock Text="{Binding Terms.LossLiability.CurrencyExchange}" 
                               Style="{StaticResource KivaTextAccentStyle}"/>
                    </StackPanel>


                    <StackPanel Orientation="Horizontal">
                        <StackPanel HorizontalAlignment="Right">
                            <TextBlock Text="{Binding Path=L.Loan, Source={StaticResource L}}" Style="{StaticResource KivaTextNormalStyle}"/>
                            <TextBlock Text="{Binding Terms.LoanAmount, Converter={StaticResource toAmount}}" Style="{StaticResource KivaTextAccentStyle}"/>
                            <TextBlock Text="{Binding PostedDate, Converter={StaticResource toShortDate}}" Style="{StaticResource KivaTextAccentStyle}"/>
                        </StackPanel>
                        <StackPanel HorizontalAlignment="Right">
                            <TextBlock Text="{Binding Path=L.Funded, Source={StaticResource L}}" Style="{StaticResource KivaTextNormalStyle}"/>
                            <TextBlock Text="{Binding FundedAmount, Converter={StaticResource toAmount}}" Style="{StaticResource KivaTextAccentStyle}"/>
                            <TextBlock Text="{Binding FundedDate, Converter={StaticResource toShortDate}}" Style="{StaticResource KivaTextAccentStyle}"/>
                            <TextBlock Text="{Binding FundedPercentage, Converter={StaticResource toPercentage}}" Style="{StaticResource KivaTextAccentStyle}"/>
                        </StackPanel>
                        <StackPanel HorizontalAlignment="Right">
                            <TextBlock Text="{Binding Path=L.Paid, Source={StaticResource L}}" Style="{StaticResource KivaTextNormalStyle}"/>
                            <TextBlock Text="{Binding PaidAmount, Converter={StaticResource toAmount}}" Style="{StaticResource KivaTextAccentStyle}"/>
                            <TextBlock Text="{Binding PaidDate, Converter={StaticResource toShortDate}}" Style="{StaticResource KivaTextAccentStyle}"/>
                            <TextBlock Text="{Binding PaidPercentage, Converter={StaticResource toPercentage}}" Style="{StaticResource KivaTextAccentStyle}"/>
                        </StackPanel>
                    </StackPanel>

                    <!-- 
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="Journals" Style="{StaticResource KivaTextNormalStyle}"/>
                <TextBlock Text="{Binding JournalEntries}" Style="{StaticResource KivaTextAccentStyle}"/>
                <TextBlock Text="Bulk" Style="{StaticResource KivaTextNormalStyle}"/>
                <TextBlock Text="{Binding JournalBulkEntries, Converter={StaticResource toShortDate}}" 
                                   Style="{StaticResource KivaTextSmallStyle}"/>
            </StackPanel>
            -->
                </StackPanel>

            </StackPanel>
        </ScrollViewer>
    </Grid>
</KCtl:BaseUserControl>
